The present disclosure relates generally to task management, and more particularly, to methods that manage and preserve task priority on real-time systems, and related devices.
Most resources of a real-time system are limited. Generally, to effectively utilize the system resource, a task having higher priority is able to interrupt the execution of a task having lower priority.
However, the so-called task priority inverse might disorder the task priorities. It can be found on platforms, which embed DMA (Direct Memory Access) to off-load a CPU (Central Processing Unit). For example, the activation of DMA will disorder the task priorities due to resource sharing with the CPU on an EMI (External Memory Interface) arbitrator. The inconsistencies between DMA usage and priority distribution therefore will reduce the system execution efficiency.
FIG. 1 is a schematic diagram illustrating the hardware architecture of an embedded system with DMA. As shown in FIG. 1, a MCU (Micro-Controller Unit) 110 can issue bus requests to an EMI arbitrator 140 for accessing an external device 150 via a MCU bus. Additionally, DMA units (121, 122, and 123) can access an internal memory 130, and just like the MCU 110, can issue bus requests to the EMI arbitrator 140 for accessing the external device 150 via a DMA bus. When a simultaneous access occurs, that is, multiple requests are received from the MCU and DMA buses, the EMI arbitrator 150 schedules the order of requests equally by round robin. In other words, the EMI arbitrator 150 executes those requests one by one from the MCU and DMA buses by turns. Therefore, in real-time systems, tasks having a higher priority, such as requests from the MCU bus, cannot fully occupy the EMI resource to complete execution as soon as possible. Conventionally, requests from the DMA bus will share the bandwidth, causing system resources to be shared among tasks having higher and lower priorities. This task priority inverse problem violates the basic concept of real-time systems. Due to the task priority inverse problem, the system execution efficiency will therefore be reduced.